<?php
/**
 * Created by PhpStorm.
 * User: WINNERWLY
 * Date: 2018/8/3
 * Time: 8:57
 */

namespace app\index\model;


use think\Model;

//use traits\model\SoftDelete;

class User extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'user';
//    use SoftDelete;
//    protected $is_delete = '1';
    protected $type = [
        'id' => 'integer',
    ];
    protected $insert = ['create_time', 'ip'];

    protected function setCreateTimeAttr()
    {
        return time();
    }

    protected function setIpAttr()
    {
        return request()->ip();
    }

    public function getSexAttr($val)
    {
        $sex = [0 => "未知", 1 => "男", 2 => "女"];
        return $sex[$val];
    }
}
